import {
    Message,
    Notification
} from 'element-ui'
import storeTool from '../lib/indexedStore'
import axios from 'axios'
import waterMeshTool from '../lib/waterMeshTool'
export default {
    data() {
        return {
            dtBeginLadar: '',
            dtEndLadar: '',
            wswscdLadar: '',
            stcdLadar: '',
            showLadarMesh: false,
            showLadarTpye: '',
            ladarName: '',
            ladarFanWei: '109.22,110.524,33.751,34.828',
            fileType: 11,
            currID: null

        }
    },
    computed: {
        basinLadar() {
            return this.$store.getters.basin
        },
        playerIndex() {
            return this.$store.getters.playerIndex
        }
    },
    watch: {
        basinLadar: {
            handler: function(index) {
                this.showLadarSel()
            }
        },
        playerIndex: {
            handler: function(index) {
                if (this.$store.getters.playerParams.name !== 'Weather') return
                this.$nextTick(() => {
                    this.updataRainYBGCOne(index)
                })
            }
        }
    },
    created() {
        this.entityMapLadar = new Map()
        this.meshCoodsMapLadar = new Map()
        this.ladarUrls = []
        this.ladarIDs = []
        this.timeArrLadar = []
        this.lastladarLayer = null
        this.ladarPrimitives = null
        // this.getLadarMeshcoords()
        this.$eventBus.$on('EB_YB_Ladar', showLadarTpye => {
            this.showLadarTpye = showLadarTpye
            if (showLadarTpye === 'YB_LD_MESH') {
                this.fileType = '11'
                this.ladarName = '组网'
            } else if (showLadarTpye === 'SC_LD_MESH') {
                this.fileType = '12'
                this.ladarName = '组网'
            } else if (showLadarTpye === 'SC_LD_MESH_PRO') {
                this.fileType = '12'
                this.ladarName = '组网'
                this.ladarFanWei = '108.69350,110.5245,33.5435,34.8288'
            } else if (showLadarTpye === 'SC_LD_FSL_JD') {
                this.ladarName = 'SA000000000M'
                this.ladarFanWei = '109.22,110.524,33.751,34.828'
            } else if (showLadarTpye === 'SC_LD_FSL_LT') {
                this.ladarName = 'SA000000001M'
                this.ladarFanWei = '108.694,109.995,33.544,34.622'
            }
            this.showLadarSel()
        })
        this.$eventBus.$on('GetRadarParams', (e) => {
            // 如果是预报降雨要判断step
            if (this.pageState.YB.indexOf('YB_') !== -1) {
                // debugger
                var step = e.Step
                if (step === '2' || step === '6' || step === '12' || step === '24') {
                    this.$eventBus.$emit('EB_YB_LD_dis', false)
                    this.clearLadarMesh()
                    return
                } else {
                    this.$eventBus.$emit('EB_YB_LD_dis', true)
                }
            }
            if (this.dtBeginLadar === e.dtBegin && this.dtEndLadar === e.dtEnd) return
            this.dtBeginLadar = e.dtBegin
            this.dtEndLadar = e.dtEnd
            this.wswscdLadar = e.wswscd
            this.stcdLadar = e.stcd
            this.showLadarSel()
        })
    },
    mounted() {
        this.$nextTick(() => {
            // this.creatLadarMesh2()
        })
    },
    methods: {
        showLadarSel() {
            this.clearLadarFSL()
            this.clearLadarMesh()
            if (this.showLadarTpye === 'YB_LD_MESH' || this.showLadarTpye === 'SC_LD_MESH') {
                this.creatLadarMesh()
            } else if (this.showLadarTpye === 'SC_LD_MESH_PRO') {
                this.creatLadarMeshPro()
            } else if (this.showLadarTpye === 'SC_LD_FSL_JD') {
                this.creatLadarFSL()
            } else if (this.showLadarTpye === 'SC_LD_FSL_LT') {
                this.creatLadarFSL()
            } else if (this.showLadarTpye === '' || this.showLadarTpye === '重置') {
                this.clearLadarFSL()
            }
        },

        creatLadarMeshPro() {
            var timeArr = []
            var urlArr = []
            var idArr = []
            this.clearLadarFSL()
            var url = '/api/PredictionRainfall/GetRadarRealRainPng'
            var param = {
                dtBegin: this.dtBeginLadar,
                // dtBegin: '2023-7-01 08:00',
                dtEnd: this.dtEndLadar
                // dtEnd: '2023-07-30 11:18'
            }
            this.$api.Get(url, param).then(res => {
                if (res.data === null) {
                    Notification({
                        message: `${this.dtBeginLadar}至${this.dtEndLadar}时间段无雷达过程数据`,
                        type: 'warning'
                    })
                    return
                }
                if (res && res.data && res.data.length > 0) {
                    res.data.forEach(item => {
                        var imgUrl = ''
                        if (item.url && item.url.length > 0) {
                            imgUrl = item.url.replace('http://183.6.105.178:8015/', 'http://183.6.105.178:8019/')
                        }
                        timeArr.push(item.tm)
                        idArr.push(item.id)
                        urlArr.push(imgUrl)
                    })
                    this.ladarUrls = urlArr
                    this.timeArrLadar = timeArr
                    this.ladarIDs = idArr
                    var player = this.$store.getters.playerParams
                    player.name = 'Weather'
                    player.width = '35%'
                    player.dragReal = true
                    player.show = true
                    player.currIndex = 0
                    player.times = timeArr
                    this.$store.dispatch('playerParams', player)
                    this.updataRainYBGCOne(0)
                }
                this.initEventLadarMeshPro()
            })
        },
        initEventLadarMeshPro() {
            var eventFn = (pickedObject, position) => {
                if (this.$store.getters.pageState.YB === 'SC_LD_MESH_PRO') {
                    var cartesian = this.$viewer.scene.globe.pick(this.$viewer.camera.getPickRay(position), this.$viewer.scene)
                    var ellipsoid = this.$viewer.scene.globe.ellipsoid
                    var cartographic = ellipsoid.cartesianToCartographic(cartesian)
                    var lat = Cesium.Math.toDegrees(cartographic.latitude)
                    var lon = Cesium.Math.toDegrees(cartographic.longitude)
                    var alt = cartographic.height
                    var url = '/api/PredictionRainfall/GetRadarRainByPoint'
                    var dtIndex = this.lastLadarLayerIndex ? this.lastLadarLayerIndex : 0
                    var dt = this.$moment(this.timeArrLadar[dtIndex]).format('YYYY-MM-DD HH:mm')
                    var param = {
                        lgtd: lon,
                        lttd: lat,
                        // dtTime: dt,
                        // fileType: 12,
                        id: this.currID
                    }
                    this.$api.Get(url, param).then(res => {
                        const popParams = this.$store.getters.popParams
                        popParams.name = '通用'
                        popParams.posX = Math.round(position.x)
                        popParams.posY = Math.round(position.y)
                        var val = res.data === null ? '-' : res.data
                        popParams.remarks = [
                            { name: null, value: val }
                        ]
                        this.$store.dispatch('popParams', popParams)
                    })
                }
            }
            this.$store.getters.eventCesiumOption.leftPickFns.set('LadarPNG', eventFn)
        },
        clearLadarFSL() {
            this.$store.dispatch('playerClose')
            this.$viewer.imageryLayers.remove(this.lastladarLayer)
            setTimeout(() => {
                if (this.lastladarLayer) {
                    this.$viewer.imageryLayers.remove(this.lastladarLayer)
                    this.lastladarLayer = null
                }
                this.lastLadarLayerIndex = null
            }, 500)
        },

        creatLadarFSL() {
            var timeArr = []
            var urlArr = []
            this.clearLadarFSL()
            var url = '/api/PredictionRainfall/GetWeatherRadarByStcd'
            var param = {
                dtBegin: this.dtBeginLadar,
                // dtBegin: '2023-7-20 08:00',
                dtEnd: this.dtEndLadar,
                // dtEnd: '2023-07-23 11:18',
                stcd: this.ladarName
                // stcd: 'SA000000001M'
            }
            this.$api.Get(url, param).then(res => {
                if (res && res.data && res.data.length > 0) {
                    res.data.forEach(item => {
                        var imgUrl = ''
                        if (item.url && item.url.length > 0) {
                            imgUrl = item.url.replace('http://183.6.105.178:8015/', 'http://183.6.105.178:8019/')
                        }
                        timeArr.push(item.tm)
                        urlArr.push(imgUrl)
                    })
                    this.ladarUrls = urlArr
                    var player = this.$store.getters.playerParams
                    player.name = 'Weather'
                    player.width = '35%'
                    player.dragReal = true
                    player.show = true
                    player.currIndex = 0
                    player.times = timeArr
                    this.$store.dispatch('playerParams', player)
                    this.updataRainYBGCOne(0)
                } else {
                    Notification({
                        message: `${this.dtBeginLadar}至${this.dtEndLadar}时间段无雷达反射率数据`,
                        type: 'warning'
                    })
                }
            })
        },
        updataRainYBGCOne(index) {
            if (this.lastLadarLayerIndex !== index) {
                // console.log(this.ladarUrls[index])
                if (this.ladarUrls[index] === '') {
                    console.log('此时刻无雷达数据')
                    if (this.lastladarLayer) {
                        var alpha2 = 1
                        var timePlayLadar2 = setInterval(() => {
                            alpha2 = alpha2 - 0.1
                            if (alpha2 <= 0.1) {
                                if (this.lastladarLayer) this.$viewer.imageryLayers.remove(this.lastladarLayer)
                                this.lastladarLayer = null
                                clearInterval(timePlayLadar2)
                            } else {
                                if (this.lastladarLayer) this.lastladarLayer.alpha = alpha2
                            }
                        }, 50)
                        // this.$viewer.imageryLayers.remove(this.lastladarLayer)
                        // this.lastladarLayer = null
                    }
                    return
                }
                this.lastLadarLayerIndex = index
                this.currID = this.ladarIDs[index]
                var fanWei = this.ladarFanWei.split(',')
                var rectangle = Cesium.Rectangle.fromDegrees(fanWei[0], fanWei[2], fanWei[1], fanWei[3])
                var img = new Cesium.SingleTileImageryProvider({
                    url: this.ladarUrls[index],
                    show: true,
                    rectangle: rectangle
                })
                img.readyPromise.then(() => {
                    if (!(this.showLadarTpye === 'SC_LD_MESH_PRO' ||
                        this.showLadarTpye === 'SC_LD_FSL_JD' ||
                        this.showLadarTpye === 'SC_LD_FSL_LT')) {
                        console.log('以取消')
                        return
                    }
                    var temp = this.$viewer.imageryLayers.addImageryProvider(img)
                    temp.alpha = 0.0
                    var alpha = 1
                    var timePlayLadar = setInterval(() => {
                        alpha = alpha - 0.1
                        if (this.timePlayLadar !== null && alpha <= 0.1) {
                            this.$viewer.imageryLayers.remove(this.lastladarLayer)
                            this.lastladarLayer = temp
                            clearInterval(timePlayLadar)
                            timePlayLadar = null
                        } else {
                            temp.alpha = 1 - alpha
                            if (this.lastladarLayer) this.lastladarLayer.alpha = alpha
                        }
                    }, 50)
                })
            }
        },
        clearLadarMesh_back() {
            if (this.entityMapLadar && this.entityMapLadar.size > 0) {
                this.entityMapLadar.forEach((value, key) => {
                    this.$viewer.entities.remove(value)
                })
                this.entityMapLadar = new Map()
            }
        },
        clearLadarMesh() {
            if (this.ladarPrimitives) {
                this.$viewer.scene.primitives.remove(this.ladarPrimitives)
                this.ladarPrimitives = null
            }
        },
        getLadarPoints() {
            return new Promise(async(resolve, reject) => {
                var url = `/mapData/guangdong/txt/ladar721point.txt`
                this.$axios.get(url).then(resPoint => {
                    var lonlats = []
                    var pointRows = resPoint.data.split('\r\n')
                    pointRows.forEach(lonlatstr => {
                        var oneLonlat = lonlatstr.split(',')
                        if (oneLonlat && oneLonlat.length > 1) {
                            lonlats.push([Number(oneLonlat[0]), Number(oneLonlat[1]), Number(oneLonlat[2])])
                        }
                    })
                    resolve(lonlats)
                })
            })
        },
        getLadarMeshs() {
            return new Promise((resolve, reject) => {
                var url = `/mapData/guangdong/txt/ladar721mesh.txt`
                this.$axios.get(url).then(resMesh => {
                    var pointIndexs = []
                    var meshs = resMesh.data.split('\r\n')
                    meshs.forEach(item => {
                        var oneRow = item.split(',')
                        pointIndexs.push(oneRow)
                    })
                    resolve(pointIndexs)
                })
            })
        },
        getLadarMeshcoords(refresh = false) {
            return new Promise((resolve, reject) => {
                if (refresh === false) {
                    storeTool.getItem('ladarIdXYZArray2023-08-04').then(res => {
                        if (res && res.size > 0) {
                            resolve(res)
                            return
                        } else {
                            resolve(this.getLadarMeshcoords(true))
                        }
                    })
                }
                var getPoint = this.getLadarPoints()
                var getMesh = this.getLadarMeshs()
                Promise.all([getPoint, getMesh])
                Promise.all([getPoint, getMesh]).then(res => {
                    const [resPoint, resMesh] = res
                    var meshLadarMeshs = new Map()
                    resMesh.forEach(mesh => {
                        var p1 = resPoint[Number(mesh[1])]
                        var p2 = resPoint[Number(mesh[2])]
                        var p3 = resPoint[Number(mesh[3])]
                        var p4 = resPoint[Number(mesh[4])]
                        var cartesian3 = Cesium.Cartesian3.fromDegreesArrayHeights([...p1, ...p2, ...p3, ...p4])
                        var cartesian3s = []
                        cartesian3.map((item) => {
                            cartesian3s.push(item.x)
                            cartesian3s.push(item.y)
                            cartesian3s.push(item.z)
                        })
                        meshLadarMeshs.set(mesh[0], cartesian3s)
                    })
                    storeTool.setItem('ladarIdXYZArray2023-08-04', meshLadarMeshs)
                    resolve(meshLadarMeshs)
                })
            })
        },
        getLadarMeshcoords_back() {
            return new Promise((resolve, reject) => {
                if (window.meshCoodsMapLadar) {
                    resolve(window.meshCoodsMapLadar)
                } else {
                    var meshCoodsMapLadar = new Map()
                    this.$axios.get(`/mapData/guangdong/geojson/ladarMesh721.json`).then(resMesh => {
                        resMesh.data.features.forEach(feature => {
                            var id = feature.properties['ID1']
                            var coordinates = feature.geometry.coordinates[0]
                            var lonlats = [] // 每个四边形的四角lonlat
                            lonlats.push(coordinates[0][0])
                            lonlats.push(coordinates[0][1])
                            lonlats.push(coordinates[1][0])
                            lonlats.push(coordinates[1][1])
                            lonlats.push(coordinates[2][0])
                            lonlats.push(coordinates[2][1])
                            lonlats.push(coordinates[3][0])
                            lonlats.push(coordinates[3][1])
                            var hierarchy = Cesium.Cartesian3.fromDegreesArray(lonlats)
                            meshCoodsMapLadar.set(id.toString(), hierarchy)
                        })
                        window.meshCoodsMapLadar = meshCoodsMapLadar
                        resolve(meshCoodsMapLadar)
                    })
                }
            })
        },
        getLadarColor(drp) {
            var color = 'rgba(110,248,255,0.555)'
            if (drp >= 0 && drp < 0.1) {
                color = 'rgba(110,248,255,0.555)'
            } else if (drp >= 0.1 && drp < 1) {
                color = 'rgba(0,255,255,0.555)'
            } else if (drp >= 1 && drp < 5) {
                color = 'rgba(0,107,253,0.555)'
            } else if (drp >= 5 && drp < 10) {
                color = 'rgba(0,0,162,0.555)'
            } else if (drp >= 10 && drp < 15) {
                color = 'rgba(115,255,138,0.555)'
            } else if (drp >= 15 && drp < 20) {
                color = 'rgba(0,255,0,0.555)'
            } else if (drp >= 20 && drp < 25) {
                color = 'rgba(0,150,50,0.555)'
            } else if (drp >= 25 && drp < 30) {
                color = 'rgba(255,180,0,0.555)'
            } else if (drp >= 30 && drp < 35) {
                color = 'rgba(255,255,0,0.555)'
            } else if (drp >= 35 && drp < 40) {
                color = 'rgba(196,166,0,0.555)'
            } else if (drp >= 40 && drp < 50) {
                color = 'rgba(255,100,100,0.555)'
            } else if (drp >= 50 && drp < 100) {
                color = 'rgba(255,0,0,0.555)'
            } else if (drp >= 100 && drp < 150) {
                color = 'rgba(128,0,0,0.555)'
            } else if (drp >= 150 && drp < 200) {
                color = 'rgba(250,200,250,0.555)'
            } else if (drp >= 200 && drp < 250) {
                color = 'rgba(200,100,155,0.555)'
            } else if (drp >= 250) {
                color = 'rgba(150,0,180,0.555)'
            }
            return color
        },
        creatLadarMesh() {
            this.clearLadarMesh()
            var url = 'api/PredictionRainfall/GetRadarStRain'
            var param = {
                dtBegin: this.dtBeginLadar,
                // dtBegin: '2023-08-02 08:00',
                dtEnd: this.dtEndLadar,
                // dtEnd: '2023-08-03 11:18',
                wswscd: this.basinLadar,
                // wswscd: 'WDA8000126100000',
                fileType: this.fileType
                // fileType: 12
            }
            var getLadarApi = this.$api.Get(url, param)
            var getLadarMesh = this.getLadarMeshcoords()
            this.$store.commit('mapLoadingPush', '请求雷达数据中...')
            Promise.all([getLadarApi, getLadarMesh]).then(res => {
                var [resApi, coordMap] = res
                console.log(resApi)
                if (resApi.data.length < 1) {
                    var sc_yb = '实测'
                    if (this.fileType === '11')sc_yb = '预报'
                    if (this.fileType === '12')sc_yb = '实测'
                    Notification({
                        message: `${this.dtBeginLadar}至${this.dtEndLadar}时间段无${sc_yb}雷达数据`,
                        type: 'warning'
                    })

                    this.$store.commit('mapLoadingDel', '请求雷达数据中...')
                    return
                }
                var geometryInstances = []
                resApi.data.forEach(item => {
                    var positions = coordMap.get(item.wscdindex.toString())
                    if (!positions) return
                    if (item.drp <= 0) return
                    var color = this.getLadarColor(item.drp)

                    const geo = new Cesium.Geometry({
                        attributes: {
                            position: new Cesium.GeometryAttribute({
                                componentDatatype: Cesium.ComponentDatatype.DOUBLE,
                                componentsPerAttribute: 3,
                                values: positions
                            })
                        },
                        // 索引
                        indices: new Uint16Array([0, 1, 2, 1, 2, 3]),
                        // 绘制类型
                        primitiveType: Cesium.PrimitiveType.TRIANGLES,
                        boundingSphere: Cesium.BoundingSphere.fromVertices(positions)
                    })
                    var instance = new Cesium.GeometryInstance({
                        geometry: geo,
                        attributes: {
                            // color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString('#cc2300'))
                            color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.fromCssColorString(color))
                        },
                        id: {
                            eventName: 'LadarMesh',
                            prop: {
                                drp: item.drp,
                                meshCode: item.wscdindex.toString()
                            }
                        }
                    })
                    geometryInstances.push(instance)
                })
                var primitive = new Cesium.Primitive({
                    geometryInstances: geometryInstances,
                    appearance: new Cesium.PerInstanceColorAppearance({
                        flat: true,
                        translucent: true
                    }),
                    asynchronous: false,
                    show: true
                })
                // this.clearOutWaterMesh()
                this.ladarPrimitives = this.$viewer.scene.primitives.add(primitive)
                this.ladarPrimitives.readyPromise.then(res => {
                    console.log(this.ladarPrimitives)
                    this.$store.commit('mapLoadingDel', '请求雷达数据中...')
                })
            }, err => {
                console.log(err)
            })
            this.initEventLadar()
        },
        creatLadarMesh_back() {
            this.clearLadarMesh()
            var url = 'api/PredictionRainfall/GetRadarStRain'
            if (this.dtBeginLadar === '') return
            var param = {
                dtBegin: this.dtBeginLadar,
                // dtBegin: '2023-07-14 08:00',
                dtEnd: this.dtEndLadar,
                // dtEnd: '2023-06-16 11:18',
                wswscd: this.basinLadar,
                // wswscd: 'WDA8000126100000',
                // stcd: this.ladarName,
                fileType: this.fileType
            }
            var getLadarApi = this.$api.Get(url, param)
            var getLadarMesh = this.getLadarMeshcoords()
            this.$store.dispatch('mapLoadingText', ['请求雷达数据中...'])
            Promise.all([getLadarApi, getLadarMesh]).then(res => {
                var [resApi, coordMap] = res
                if (resApi.data.length < 1) {
                    var sc_yb = '实测'
                    if (this.fileType === '11')sc_yb = '预报'
                    if (this.fileType === '12')sc_yb = '实测'
                    Notification({
                        message: `${this.dtBeginLadar}至${this.dtEndLadar}时间段无${sc_yb}雷达数据`,
                        type: 'warning'
                    })
                    // this.$store.dispatch('mapLoadingText', ['此时间段无数据'])
                    // setTimeout(() => {
                    //     this.$store.dispatch('mapLoadingText', [])
                    // }, 1000)
                    this.$store.dispatch('mapLoadingText', [])
                    return
                }
                var alpha = 0.555
                resApi.data.forEach(item => {
                    var coord = coordMap.get(item.wscdindex.toString())
                    if (!coord) return
                    var drp = item.drp
                    var color = 'rgba(99,99,99,0.0)'
                    if (drp <= 0) return
                    if (drp > 0 && drp < 0.1) {
                        color = 'rgba(99,99,99,0.555)'
                    } else if (drp >= 0.1 && drp < 0.2) {
                        color = 'rgba(0,172,164,0.555)'
                    } else if (drp >= 0.2 && drp < 0.4) {
                        color = 'rgba(192,192,254,0.555)'
                    } else if (drp >= 0.4 && drp < 0.6) {
                        color = 'rgba(122,114,238,0.555)'
                    } else if (drp >= 0.6 && drp < 0.8) {
                        color = 'rgba(30,38,208,0.555)'
                    } else if (drp >= 0.8 && drp < 0.555) {
                        color = 'rgba(166,252,168,0.555)'
                    } else if (drp >= 1 && drp < 2) {
                        color = 'rgba(0,234,0,0.555)'
                    } else if (drp >= 2 && drp < 4) {
                        color = 'rgba(252,244,100,0.555)'
                    } else if (drp >= 4 && drp < 6) {
                        color = 'rgba(252,244,100,0.555)'
                    } else if (drp >= 6 && drp < 8) {
                        color = 'rgba(200,200,2,0.555)'
                    } else if (drp >= 8 && drp < 10) {
                        color = 'rgba(144,144,0,0.555)'
                    } else if (drp >= 10 && drp < 15) {
                        color = 'rgba(254,172,172,0.555)'
                    } else if (drp >= 15 && drp < 20) {
                        color = 'rgba(254,100,92,0.555)'
                    } else if (drp >= 20 && drp < 25) {
                        color = 'rgba(238,2,48,0.555)'
                    } else if (drp >= 25 && drp < 30) {
                        color = 'rgba(212,142,254,0.555)'
                    } else if (drp >= 30) {
                        color = 'rgba(170,36,250,0.555)'
                    }
                    // console.log(coord[0])
                    // var center = new Cesium.Cartesian3(coord[0].x * 0.5 + coord[2].x * 0.5,
                    //     coord[0].y * 0.5 + coord[2].y * 0.5, coord[0].z * 0.5 + coord[2].z * 0.5)
                    var polyEntity = {
                        eventName: 'Ladar',
                        drp: drp,
                        // wscdindex: item.wscdindex,
                        // position: center,
                        // label: {
                        //     text: drp,
                        //     font: '14px monospace',
                        //     heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
                        //     distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000)
                        // },
                        polygon: {
                            hierarchy: coord,
                            material: Cesium.Color.fromCssColorString(color)
                            // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(nearFar, 500000)
                        },
                        show: true
                    }
                    this.entityMapLadar.set(item.wscdindex, this.$viewer.entities.add(polyEntity))
                })
                this.$store.dispatch('mapLoadingText', [])
            }, err => {
                console.log(err)
            })
            this.initEventLadar()
        },
        initEventLadar_back() {
            var eventFn = (pickedObject, position) => {
                if (
                    pickedObject &&
                    pickedObject.id &&
                    pickedObject.id.eventName
                ) {
                    if (pickedObject.id.eventName === 'Ladar') {
                        const popParams = this.$store.getters.popParams
                        popParams.posX = Math.round(position.x)
                        popParams.posY = Math.round(position.y)
                        popParams.name = '通用'
                        popParams.remarks = [
                            { name: null, value: pickedObject.id.drp }
                        ]
                        this.$store.dispatch('popParams', popParams)
                    }
                }
            }
            this.$store.getters.eventCesiumOption.leftPickFns.set('Ladar', eventFn)
        },
        initEventLadar() {
            var eventFn = (pickedObject, position) => {
                if (
                    pickedObject &&
                    pickedObject.id &&
                    pickedObject.id.eventName
                ) {
                    if (pickedObject.id.eventName === 'LadarMesh') {
                        const popParams = this.$store.getters.popParams
                        popParams.posX = Math.round(position.x)
                        popParams.posY = Math.round(position.y)
                        popParams.name = '通用'
                        popParams.remarks = [
                            { name: null, value: pickedObject.id.prop.drp }
                        ]
                        this.$store.dispatch('popParams', popParams)
                    }
                }
            }
            this.$store.getters.eventCesiumOption.leftPickFns.set('LadarMesh', eventFn)
        }
    }
}
